"use client"; import { useParams } from "next/navigation"; import { DatabasePageView } from "@/components/database/database-page-view"; import { useWorkspace } from "@/hooks/use-workspace"; /** * /w/:workspace/databases/:id — database home. * * Note: the core page canvas (/w/:ws/page/:id) now branches on * `page.databaseId` (components/editor/page-canvas.tsx) and renders this same * DatabasePageView for database pages — the sidebar links databases there. * This dedicated route remains the canonical standalone database surface * (full toolbar + view router). */ export default function DatabaseRoutePage() { const params = useParams<{ workspace: string; id: string }>(); const workspaceSlug = params?.workspace ?? ""; const databaseId = params?.id ?? ""; const { data: workspace } = useWorkspace(workspaceSlug); // Read-only when the member has a viewer role. // NOTE: the core `WorkspaceRole` type is lowercase, but the API currently // serializes `role` as the raw UPPERCASE Prisma enum ("GUEST") with no // normalizing serializer (flagged to the core agent). Compare case-insensitively // so this is correct under either eventual resolution. const readOnly = (workspace?.role ?? "").toLowerCase() === "guest"; return (